[NET] back: Fix off-by-one error in netbk_tx_err
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 3 Jul 2006 07:57:15 +0000 (08:57 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 3 Jul 2006 07:57:15 +0000 (08:57 +0100)
The generalised extra request info patch introduced a bug with the use
of netbk_tx_err since it advanced the req_cons pointer by one.  This
patch fixes thing by delaying the increment in netbk_tx_err.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
linux-2.6-xen-sparse/drivers/xen/netback/netback.c

index 93e39612bc3cc2cc8a701f77d0b0e6882cd3aa9c..5171d0ab02c7e9a8e4c28e7e64b89d9a343836f3 100644 (file)
@@ -496,9 +496,9 @@ static void netbk_tx_err(netif_t *netif, netif_tx_request_t *txp, RING_IDX end)
 
        do {
                make_tx_response(netif, txp, NETIF_RSP_ERROR);
-               if (++cons >= end)
+               if (cons >= end)
                        break;
-               txp = RING_GET_REQUEST(&netif->tx, cons);
+               txp = RING_GET_REQUEST(&netif->tx, cons++);
        } while (1);
        netif->tx.req_cons = cons;
        netif_schedule_work(netif);
@@ -764,11 +764,11 @@ static void net_tx_action(unsigned long unused)
                if (txreq.flags & NETTXF_extra_info) {
                        work_to_do = netbk_get_extras(netif, extras,
                                                      work_to_do);
+                       i = netif->tx.req_cons;
                        if (unlikely(work_to_do < 0)) {
-                               netbk_tx_err(netif, &txreq, 0);
+                               netbk_tx_err(netif, &txreq, i);
                                continue;
                        }
-                       i = netif->tx.req_cons;
                }
 
                ret = netbk_count_requests(netif, &txreq, work_to_do);